import request from "@/utils/request"
export default{
    //角色分页查询
    getList(query,current=1,size=20){
        return request({
            url:`/system/role/search`,
            method:"post",
            data:{
                ...query,
                current,
                size
            }
        })
    },
    //新增角色
    add(data){
        return request({
            url:`/system/role`,
            method:"post",
            data:data
        })
    },
    //查询
    getById(id){
        return request({
            url:`/system/role/${id}`,
            method:"get"
        })
    },
    //更新
    update(data){
        return request({
            url:`/system/role`,
            method:"put",
            data:data
        })
    },
    //删除
    deleteById(id){
        return request({
            url:`/system/role/${id}`,
            method:"delete",
        })
    },
    //获取指定角色id所拥有的权限菜单ids
    getMenuIdsByRoleId(id){
        return request({
            url:`/system/role/${id}/menu/ids`,
            method:"get"
        })
    },
    //添加新增角色权限接口的方法
    saveRoleMenu(id,menuIds){
        return request({
            url:`/system/role/${id}/menu/save`,
            method:"post",
            data:menuIds
        })
    }
}